home *** CD-ROM | disk | FTP | other *** search
- /*
- * (c) Copyright 1992 by Panagiotis Tsirigotis
- * All rights reserved. The file named COPYRIGHT specifies the terms
- * and conditions for redistribution.
- */
-
- static char RCSid[] = "$Id: buftest.c,v 7.1 1992/06/01 21:38:57 panos Exp $" ;
-
- /*
- * This program is used to test the Sbuftype system call.
- * It prints two groups of lines. The first group is printed
- * using line-buffering while the seconde group is printed using
- * full-buffering.
- *
- * The first group of lines should appear one line at a time every
- * 3 seconds. The second group of lines should appear all lines together
- * after about 10 seconds.
- */
-
- #include "sio.h"
-
- main()
- {
- int i ;
- int sleep_interval = 3 ;
-
- if ( Sbuftype( 1, SIO_LINEBUF ) == SIO_ERR )
- {
- Sprint( 2, "Sbuftype failed\n" ) ;
- exit( 1 ) ;
- }
-
- for ( i = 0 ; i < 10 ; i++ )
- {
- Sprint( 1, "Line %d\n", i ) ;
- if ( i == 5 )
- {
- Sprint( 1, "Now switching to full buffering\n" ) ;
- sleep_interval = 2 ;
- if ( Sbuftype( 1, SIO_FULLBUF ) == SIO_ERR )
- {
- Sprint( 2, "2nd Sbuftype failed\n" ) ;
- exit( 1 ) ;
- }
- }
- sleep( sleep_interval ) ;
- }
- exit( 0 ) ;
- }
-
-